import { defineAsyncComponent } from 'vue';
const components = import.meta.glob('@/business/components/**/*.vue');

export default function install(app) {
  Object.entries(components).forEach(([key, value]) => {
    let paths = key.replace('/src/business/components/', '').split('/');
    let name = 'bc-' + paths[0];
    name = name.replace(/[A-Z]/g, function(str){
      return '-' + str.toLowerCase();
    });
    app.component(name, defineAsyncComponent(value));
  });
}